package com.cmc.cloud.cmclink.doc.controller.admin;

import com.cmc.cloud.cmclink.doc.constants.UrlConstants;
import com.cmc.cloud.cmclink.doc.service.PatnerSiMaintenanceService;
import com.cmc.cloud.cmclink.doc.vo.partner.PartnerSiMaintenanceDeleteReqVO;
import com.cmc.cloud.cmclink.doc.vo.partner.PartnerSiMaintenancePageReqVO;
import com.cmc.cloud.cmclink.doc.vo.partner.PartnerSiMaintenancePageRespVO;
import com.cmes.framework.biz.advice.annotations.UseResponsePropertyAdvice;
import com.cmes.framework.common.pojo.CommonResult;
import com.cmes.framework.common.pojo.PageResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;



/**
 * 合作方SI维护
 * 
 * @author codegen
 */
@Tag(name = "管理后台 - 合作方SI维护")
@RestController
@RequestMapping(UrlConstants.APPLICATION_URL+"/partner")
@Validated
public class PartnerSiMaintenanceController {

    @Resource
    private PatnerSiMaintenanceService patnerSiMaintenanceService;


    /**
     * 合作方SI维护删除提单
     * @param deleteReqVo 操作删除参数
     */
    @PostMapping("/si/batchDelete")
    @PreAuthorize("@ss.hasPermission('doc:partnerSi:delete')")
    public CommonResult<Void> deleteBatchBlnos(@RequestBody PartnerSiMaintenanceDeleteReqVO deleteReqVo) {
        patnerSiMaintenanceService.deleteBatchBlnoById(deleteReqVo.getBlnoIdList());
        return CommonResult.success();
    }

    /**
     * 合作方SI维护分页列表查询
     * @param pageVO 查询条件
     */
    @Operation(summary = "合作方SI信息维护分页")
    @UseResponsePropertyAdvice
    @PostMapping("/si/selectList")
    public CommonResult<PageResult<PartnerSiMaintenancePageRespVO>> qryPartnerSiMaintenancePage(@Valid @RequestBody PartnerSiMaintenancePageReqVO pageVO) {
        PageResult<PartnerSiMaintenancePageRespVO> partnerSiMaintenancePageRespVoPageResult = patnerSiMaintenanceService.qryPartnerSiMaintenancePage(pageVO);
        return CommonResult.success(new PageResult<>(partnerSiMaintenancePageRespVoPageResult.getList(),partnerSiMaintenancePageRespVoPageResult.getTotal()));
    }
}
